package Ep03_HashTable._0001;

/**
 * @author Jimmy Zhan WORKSTATION
 * @date 2023/3/6 13:57
 * 说明：力扣 0001 两数之和  拉垮的暴力解法
 */

public class ViolentSolution {
    public static void main(String[] args) {
        int[] nums = {2,7,11,15};
        int target = 9;
        ViolentSolution m = new ViolentSolution();
        int[] res = m.twoSum(nums, target);
        for (int i = 0; i < 2; i++) {
            System.out.println(res[i]);
        }
    }
    public int[] twoSum(int[] nums, int target){
        int[] temp = {-1, -1};
        for (int i = 0; i < nums.length-1; i++) {
            for (int j = i + 1; j < nums.length; j++) {
                if (nums[i] + nums[j] == target){
                    temp[0] = i;
                    temp[1] = j;
                }
            }
        }
        return temp;
    }
}
